/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __ISKYBOX_H__
#define __ISKYBOX_H__

#pragma once
#include "ITexture.h"
#include "IShaderEffect.h"
#include "IResource.h"

/**
 * \ingroup CoreEngine
 *
 * The ISkyBox interface.<br>
 * Draws a skybox around the scene.<br>
 * This box is always translated with the camera.<br>
 * A texture can be assigned using setCubeMap()<br>
 * A skybox can be created using ResourceFactory::createSkyBox()
 *
 * \date 03-28-2007
 *
 * \author juckel
 *
 */
class DLL_EXPORT ISkyBox
	: public IResource
{
public:
	/// Creates a new ISkyBox object and returns the pointer
	static ISkyBox* Create(const std::string &shader = "");

	virtual ~ISkyBox(void);

	/// Draw method needs to be implemented
	virtual void draw(math::Matrix4* reflMat = NULL, float blendFactor = 0);

	/// Assigns a cube map to the SkyBox
	virtual void setCubeMap(ITexture *texture);

	/// Assigns a cube map the the SkyBox the current cubemap can blend to
	virtual void setCubeMapBlend(ITexture *texture);

	virtual std::string getClassType() const { return "ISkyBox"; }

	virtual unsigned int getType() { return RESTYPE_SKYBOX; };
protected:
	virtual void drawData() = 0;
	ISkyBox(void);

	IShaderEffect *pEffect;
	ITexture      *pCubeMap;
	ITexture      *pCubeMapBlend;

private:
	SHADERHANDLE hInvWorldViewProjMat;
	SHADERHANDLE hBlendFactor;
	SHADERHANDLE hEnvironmentTexture;
	SHADERHANDLE hEnvironmentTextureBlend;
};

#endif
